package com.springapp.mvc;

import org.json.JSONException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class PersonController {
    @Autowired
    private SimpleDao simpleDao;

    @RequestMapping(value = "/api/person", method = RequestMethod.GET)
    public
      @ResponseBody
      String findByCustomerId(ModelMap model) throws JSONException {
      return simpleDao.select("Gigel", "Ionescu").iterator().next().getFirstName();
    }
}
